Repository navigation
Classify premium_daily and drop wait-time words from limit_type - #107
Draft
makegov-hal[bot] wants to merge 2 commits into
Draft
makegov-hal[bot] wants to merge 2 commits into
makegov-hal[bot] wants to merge 2 commits into
Conversation
limit_type read the rate name from "exceeded for <name>" but then substring-matched "daily" in it, so a per-feature premium_daily cap came back as "daily". The no-match fallback still treated "minute" as burst and "day" as daily, words that appear in the wait text itself. Map the rate name exactly (daily, burst, premium_daily; anything else is None), and have the fallback match only the whole words "daily" and "burst". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YNPQk6UN72ZCQV9Ck6kfu8
Single backticks in the docstring, wrapped under 150 chars, and the CHANGELOG fix collapsed to one bullet. Refs #108 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YNPQk6UN72ZCQV9Ck6kfu8
Closed
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #108
What
Tightens
TangoRateLimitError.limit_typeintango/exceptions.py:Rate limit exceeded for <name>.), the name maps exactly:daily→"daily",burst→"burst",premium_daily→"premium_daily". A name the SDK doesn't recognize returnsNone.Why
The headline bug (a daily 429 whose wait reads "9 hours, 14 minutes, 3 seconds" coming back as
burst) was already fixed in 1.18.2. Two holes were left:premium_dailycame back asdaily. The code substring-matched "daily" inside the rate name, so a per-feature cap (currently the CALC labor-rate endpoints) was indistinguishable from the account-wide daily lockout. The two need different handling: one blocks a single endpoint, the other blocks everything.exceeded forin the detail, "minute" meant burst and "day" meant daily, and those words show up in the wait text (Expected available in 3 minutes.).The rate names come from the API's
DEFAULT_THROTTLE_RATES(daily,burst) andPREMIUM_QUERY_DEFAULT_RATES(premium_daily), and the detail strings fromapi/throttles.py.Testing
uv run pytest: 677 passed, 31 skipped.test_limit_type_reads_the_rate_name_not_the_waitwith a daily detail carrying hours, minutes, and seconds, a burst detail, apremium_dailydetail, the team-pooled daily detail (with the "shared by everyone on your team" sentence appended), and an unrecognized rate name.test_limit_type_without_a_rate_name_matches_only_the_words_daily_and_burstfor the fallback. Against the old code, thepremium_daily, "3 minutes", and "1 day" cases fail.ruff checkandruff format --checkpass on the changed files.No version bump.
🤖 Generated with Claude Code